﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ZhQuiz.Models;

namespace ZhQuiz.Controllers
{
    public class Services
    {
        public Models.SiteDb DB { get; set; }
        public aspnet_Users SiteUser { get; set; }
        public static int DefaultPageSize = 25;


        public ListViewModel<CommonSearchValues, IQueryable<T>> ParseListViewModeJsonFilter<T>(string CurrentFilterOfJson)
        {
            return ParseListViewModeJsonFilterEx<CommonSearchValues, T>(CurrentFilterOfJson);
        }
        public ListViewModel<M, IQueryable<T>> ParseListViewModeJsonFilterEx<M, T>(string CurrentFilterOfJson)
        {
            var tm = System.Web.Helpers.Json.Decode<ListViewModel<M, string>>(CurrentFilterOfJson);
            ListViewModel<M, IQueryable<T>> m = new ListViewModel<M, IQueryable<T>>()
            {
                SearchFrom = tm.SearchFrom,
                SearchTo = tm.SearchTo
            };
            return m;
        }


    }
}